import { Hono } from 'hono'

const app = new Hono()

app.get('/', (c) => {
    return c.text('Hello, Hono!')
})

app.post('/msg', async (c) => {
    const body = await c.req.json()
    console.log('Received message:', body)

    if (body.content && typeof body.content !== 'string' && body.content.length) {
        body.content.forEach((item: any) => {
            console.log('body.content => ', item)
        })
    }

    return c.text('hello world')
})

export default {
    port: 9000,
    fetch: app.fetch,
}
